home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 November: Tool Chest / Dev.CD Nov 98 TC.toast / Sample Code / Snippets / QuickDraw / ClutWind / CLUTSample.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-07-15  |  4.5 KB  |  111 lines  |  [TEXT/MPS ]

  1. /*------------------------------------------------------------------------------
  2. #
  3. #    Apple Macintosh Developer Technical Support
  4. #
  5. #    CLUTSample
  6. #
  7. #    CLUTSample.h    -    Rez and C Include Source
  8. #
  9. #
  10. #   Loosely based in the sample SAMPLE this program shows
  11. #   how to create a window and display on it the colors of the CLUT
  12. #    associated with the device the window sits on top of.
  13. #
  14. #    Left to the curious reader are some improvements such as, remembering the
  15. #    positions of each open window, so if you use this program to monitor your
  16. #    color tables it will position the windows in the last place you opened them.
  17. #    The treatment of direct devices is kind of 'casual' a better color display may 
  18. #    be appropriate. Last, it may be desireable to change the size of the color
  19. #    rectangles depending on the depth of the color table.
  20.  
  21. #    Check Sample sources for more detailed documentation.
  22.  
  23. #    Copyright © 1989 Apple Computer, Inc.
  24. --------------------------------------------------------------------------------*/
  25. #define kMinSize    23                /* application's minimum size (in K) */
  26.  
  27. /*    We made the preferred size bigger than the minimum size by 12K, so that
  28.     there would be even more room for the scrap, FKEYs, etc. */
  29.  
  30. #define kPrefSize    35                /* application's preferred size (in K) */
  31.  
  32. #define    rMenuBar    128                /* application's menu bar */
  33. #define    rAboutAlert    128                /* about alert */
  34. #define    rUserAlert    129                /* error user alert */
  35. #define    rWindow        128                /* application's window */
  36.  
  37. /* kSysEnvironsVersion is passed to SysEnvirons to tell it which version of the
  38.    SysEnvRec we understand. */
  39.  
  40. #define    kSysEnvironsVersion        1
  41.  
  42. /* kOSEvent is the event number of the suspend/resume and mouse-moved events sent
  43.    by MultiFinder. Once we determine that an event is an osEvent, we look at the
  44.    high byte of the message sent to determine which kind it is. To differentiate
  45.    suspend and resume events we check the resumeMask bit. */
  46.  
  47. #define    kOSEvent                app4Evt    /* event used by MultiFinder */
  48. #define    kSuspendResumeMessage    1        /* high byte of suspend/resume event message */
  49. #define    kResumeMask                1        /* bit of message field for resume vs. suspend */
  50. #define    kMouseMovedMessage        0xFA    /* high byte of mouse-moved event message */
  51. #define    kNoEvents                0        /* no events mask */
  52.  
  53. /* The following constants are used to identify menus and their items. The menu IDs
  54.    have an "m" prefix and the item numbers within each menu have an "i" prefix. */
  55.  
  56. #define    mApple                    128        /* Apple menu */
  57. #define    iAbout                    1
  58.  
  59. #define    mFile                    129        /* File menu */
  60. #define    iNew                    1
  61. #define    iClose                    2
  62. #define    iQuit                    4
  63.  
  64. /*    1.01 - kTopLeft - This is for positioning the Disk Initialization dialogs. */
  65.  
  66. #define kDITop                    0x0050
  67. #define kDILeft                    0x0070
  68.  
  69. /*    1.01 - kMinHeap - This is the minimum result from the following
  70.     equation:
  71.         
  72.         ORD(GetApplLimit) - ORD(ApplicZone)
  73.         
  74.     for the application to run. It will insure that enough memory will
  75.     be around for reasonable-sized scraps, FKEYs, etc. to exist with the
  76.     application, and still give the application some 'breathing room'.
  77.     To derive this number, we ran under a MultiFinder partition that was
  78.     our requested minimum size, as given in the 'SIZE' resource. */
  79.      
  80. #define kMinHeap                21 * 1024
  81.     
  82. /*    1.01 - kMinSpace - This is the minimum result from PurgeSpace, when called
  83.     at initialization time, for the application to run. This number acts
  84.     as a double-check to insure that there really is enough memory for the
  85.     application to run, including what has been taken up already by
  86.     pre-loaded resources, the scrap, code, and other sundry memory blocks. */
  87.      
  88. #define kMinSpace                8 * 1024
  89.  
  90. /* kExtremeNeg and kExtremePos are used to set up wide open rectangles and regions. */
  91.  
  92. #define kExtremeNeg                -32768
  93. #define kExtremePos                32767 - 1 /* required to address an old region bug */
  94.  
  95. /* these #defines are used to set enable/disable flags of a menu */
  96.  
  97. #define AllItems    0b1111111111111111111111111111111    /* 31 flags */
  98. #define NoItems        0b0000000000000000000000000000000
  99. #define MenuItem1    0b0000000000000000000000000000001
  100. #define MenuItem2    0b0000000000000000000000000000010
  101. #define MenuItem3    0b0000000000000000000000000000100
  102. #define MenuItem4    0b0000000000000000000000000001000
  103. #define MenuItem5    0b0000000000000000000000000010000
  104. #define MenuItem6    0b0000000000000000000000000100000
  105. #define MenuItem7    0b0000000000000000000000001000000
  106. #define MenuItem8    0b0000000000000000000000010000000
  107. #define MenuItem9    0b0000000000000000000000100000000
  108. #define MenuItem10    0b0000000000000000000001000000000
  109. #define MenuItem11    0b0000000000000000000010000000000
  110. #define MenuItem12    0b0000000000000000000100000000000
  111.